// import { cloudbaseApp, development } from './cloudbase-api';
// const db = cloudbaseApp().database();
// const $ = db.command.aggregate;
// const _ = db.command;
// const {
//   HDBDBNAME, JINWENGDB, HDINDEXIMG, SGBDBNAME,
// } = development();

export async function getItems(limit, page) {
  const startDate = 20211101;
  let endDate = 20211228;
  const year = new Date().getFullYear();
  const month = (new Date().getMonth() + 1).toString().padStart(2, "0");
  const day = new Date().getDate().toString().padStart(2, "0");
  const hous = new Date().getHours();
  const nextDate = new Date(year, month - 1, day + 1);
  // if(hous > 21){
  //   endDate = Number(nextDate.getFullYear() + (nextDate.getMonth() + 1).toString().padStart(2,'0') + nextDate.getDate().toString().padStart(2,'0'))
  // } else {
  endDate = Number(year + month + day);
  // }
  // const skip = (page - 1) * limit;
  // const count = await db.collection(HDBDBNAME).where({
  //   _id: _.and(_.gte(startDate), _.lte(endDate))
  // }).count();
  // const { total } = count;
  // const data = await db.collection(HDBDBNAME).where({
  //   _id: _.and(_.gte(startDate), _.lte(endDate))
  // }).limit(limit).skip(skip)
  //   .orderBy('_id', 'desc')
  //   .get();
  // data.total = total;
  // return data;
}
export async function getItem(id) {
  // const res = await db.collection(HDBDBNAME).doc(id).get();
  // return res.data[0]
}
/**
 * 获取经文
 * @param id
 * @returns {Promise<cloudbase.database.GetRes>}
 */
export function getJwItem(id) {
  // return db.collection(JINWENGDB).doc(id).get();
}
/**
 * 获取少儿赞美
 * @param id
 * @returns {Promise<cloudbase.database.GetRes>}
 */
export function getSrZmItemId(id) {
  // return db.collection(SGBDBNAME).where({ shijiIndex: 3, _id: id }).get();
}
